<div class="nav">
    <a href="{:U('Order/index')}">返回订单列表</a>
    <a class="sel" href="#">订单详细信息</a>
</div>
<div>
    <h3  class="table_order_h">订单基本信息</h3>
    <table class="table_order_info">
        <tbody>
            <tr><td>订单编号：</td><td>{$order.order_no}</td><td>订单状态：</td><td>{$order.status_str}</td></tr>
            <tr><td>订购会员：</td><td>{$order.member_id|show_member_name}</td><td>获得赠送积分：</td><td>{$order.get_point}</td></tr>
            <tr><td>用户备注：</td><td>{$order.remark_member}</td><td>管理员备注：</td><td>{$order.remark_admin}</td></tr>
            <tr><td>订单来源：</td><td>{$source_str}</td><td></td><td></td></tr>
        </tbody>
    </table>
    
    <h3  class="table_order_h">订单操作</h3>
    <table class="table_order_info">
        <tbody>
            <tr><td>
                    <div id="btn_action"></div>
            </td></tr>
        </tbody>
    </table>
    
    <h3 class="table_order_h">支付信息</h3>
    <table class="table_order_info">
        <tbody>
            <tr><td>商品金额：</td><td>{$order.total_cart}</td><td>运费：</td><td>{$order.total_delivery}</td>
            <td style="display:none">保价费用：</td><td style="display:none">{$order.total_save_price}</td>
            </tr>
            <tr><td>优惠券抵扣：</td><td>{$order.total_pay_yhq}</td>
            <td >优惠折扣金额：</td><td >{$order.total_discount}</td>
            </tr>
            <tr><td>积分支付：</td><td>{$order.total_pay_point}</td><td>花费积分：</td><td>{$order.total_point}</td></tr>
            <tr><td colspan="1">总计：</td><td>{$order.total}</td><td>已支付金额：</td><td>{$order.total_pay}</td></tr>
            
                <tr><td><font color=red>还需支付金额：</font></td><td colspan="3"><font color=red>{$order.total_need_pay}</font></td></tr>
                
            <tr><td>支付方式：</td><td colspan="5">{$order.str_pay_type} {$order.trade_no}</td></tr>
        </tbody>
        
    </table>
    
    <h3 class="table_order_h">支付记录</h3>
    <table class="table_order_info">
        <thead>
            <tr><td>时间</td><td>支付金额</td><td>支付方式</td></tr>
        </thead>
        <tbody>
            <foreach name="record_pay" item="record_pay_item">
            <tr><td>{$record_pay_item.time_create|date='Y-m-d H:i:s',###}</td><td>￥{$record_pay_item.money}</td><td>{$record_pay_item.payment}</td></tr>
            </foreach>
        </tbody>
    </table>
    
    
    <h3 class="table_order_h">配送信息</h3>
    
     <table class="table_order_info">
        <tbody>
            <tr><td>配送方式：</td><td>{$order.delivery_type}</td></tr>
            <tr><td>商品总重：</td><td>{$order.total_weight} g </td></tr>
            <tr><td>物流保价：</td><td>{$order['is_save_price']?'是':'否'}</td></tr>
            <tr><td>配送时间：</td><td>{$order.delivery_time}</td></tr>
            <tr><td>配送公司：</td><td>{$order.delivery_company}</td></tr>
              <tr><td>配送公司代码：</td><td>{$order.delivery_code}</td></tr>
            <tr><td>配送单号：</td><td>{$order.delivery_no}</td></tr>
            <if condition="!empty($order['takeself'])">
            <tr><td>自提点信息：</td><td>{$order.takeself}</td></tr>
            </if>
            <tr><td>收货人：</td><td>{$order.addr_realname}</td></tr>
            <tr><td>地区：</td><td>{$order.addr_province}{$order.addr_city}{$order.addr_area}</td></tr>
            <tr><td>详细地区：</td><td>{$order.addr_address}</td></tr>
            <tr><td>邮编：</td><td>{$order.addr_zip}</td></tr>
            <tr><td>手机：</td><td>{$order.addr_phone}</td></tr>
            <tr><td>电话：</td><td>{$order.addr_tel}</td></tr>
            <tr><td>邮箱：</td><td>{$order.addr_email}</td></tr>
        </tbody>
    </table>
    
    <h3 class="table_order_h">商品信息</h3>
    <table class="table_order_info">
        <thead>
            <tr><td>商品图片</td><td>商品名称</td><td>商品参数</td><td>单价</td><td>数量</td><td>小计</td></tr>
        </thead>
        <tbody>
            <foreach name="goods" item="goods_item">
                <tr><td><a href="{:U('Home/Goods/index',array('id'=>$goods_item['goods_id']))}" target="_blank"><img src="__ROOT__{$goods_item.goods_picture}" width="80px" height="80px" /></a></td>
                    <td><a href="{:U('Home/Goods/index',array('id'=>$goods_item['goods_id']))}" target="_blank">{$goods_item.goods_name}</a></td>
                    <td>商品编号：{$goods_item.goods_sn}<br>
                        商品重量：{$goods_item.goods_weight}g<br>
                        {$goods_item.goods_spec}
                    </td>
                    <td>{$goods_item.goods_price}</td>
                    <td>{$goods_item.goods_num}</td>
                    <td>{$goods_item.sub_total}</td>
                </tr>
            </foreach>
        </tbody>
        
    </table>
    
    
    <h3 class="table_order_h">订单跟踪信息</h3>
     <table class="table_order_info">
        <thead>
            <tr><td>时间</td><td>描述</td><td>操作人</td></tr>
        </thead>
        <tbody>
            <foreach name="record" item="record_item">
            <tr><td>{$record_item.create_time}</td><td>{$record_item.spec}</td><td>{$record_item.action_name}</td></tr>
            </foreach>
        </tbody>
    </table>
     
    <notempty name="kuaiid_list">
     <h3 class="table_order_h">物流信息</h3>
     <table class="table_order_info">
        <thead>
            <tr><td>时间</td><td>进度</td></tr>
        </thead>
        <tbody>
           <volist name="kuaiid_list['Traces']" id="item">
            <tr><td>{$item.AcceptTime}</td>
            <td>{$item.AcceptStation}</td>
            </tr>
            </volist>
        </tbody>
    </table>
     </notempty>
    
    <input type="hidden" name="order_id" id="order_id" value="{$order.order_id}" />
    <input type="hidden" name="total_need_pay" id="total_need_pay" value="{$order.total_need_pay}" />
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/common/artDialog6/css/ui-dialog.css" />
    <script type="text/javascript" src="__PUBLIC__/common/artDialog6/dist/dialog-min.js"></script>
    <script type="text/javascript">
        var order_id = $("#order_id").val();
        var url_get_btn = "{:U('get_btn',array('order_id'=>$order['order_id']))}?list_url={$list_url}";//获得操作按钮地址
        var url_confirm_1 = "{:U('confirm_1',array('order_id'=>$order['order_id']))}";//取消审核
        var url_confirm_2 = "{:U('confirm_2',array('order_id'=>$order['order_id']))}";//审核
        var url_confirm_5 = "{:U('confirm_5',array('order_id'=>$order['order_id']))}";//作废
        var url_pay_3 = "{:U('pay_3',array('order_id'=>$order['order_id']))}";//支付
        var url_delivery_2 = "{:U('delivery_2',array('order_id'=>$order['order_id']))}";//发货
        var url_delivery_4 = "{:U('delivery_4',array('order_id'=>$order['order_id']))}";//确认到货
        //获取订单操作按钮
        function get_btn() {
            $("#btn_action").load(url_get_btn,{n:Math.random()});
        }
        
        get_btn();
                    
        //订单取消审核
        function confirm_1() {
            var d = dialog({
                title: '系统提示'
            });
            d.content('<img src="'+root+'/Public/system/images/ajax_loading.gif" />正在操作中...，请稍等！');
            d.show();
            $.getJSON(url_confirm_1,function(json){
                if(json.status == 'success') {
                    d.content('操作成功');
                    get_btn();
                } else {
                    d.content('操作失败：'+json.msg);
                }
            });
        }
        
        //订单审核通过
        function confirm_2() {
            var d = dialog({
                title: '系统提示'
            });
            d.content('<img src="'+root+'/Public/system/images/ajax_loading.gif" />正在操作中...，请稍等！');
            d.show();
            $.getJSON(url_confirm_2,function(json){
                if(json.status == 'success') {
                    d.content('操作成功');
                    get_btn();
                } else {
                    d.content('操作失败：'+json.msg);
                }
            });
        }
        
        //订单作废
        function confirm_5() {
            var d = dialog({
                title: '系统提示'
            });
            d.content('<img src="'+root+'/Public/system/images/ajax_loading.gif" />正在操作中...，请稍等！');
            d.show();
            $.getJSON(url_confirm_5,function(json){
                if(json.status == 'success') {
                    d.content('操作成功');
                    get_btn();
                } else {
                    d.content('操作失败：'+json.msg);
                }
            });
        }
        
        //订单支付
        function pay_3() {
            var total = $("#total_need_pay").val();
            var d = dialog({
                title: '订单支付',
                content:'<table><tr><td>订单金额：</td><td>'+total+'</td></tr><tr><td>支付方式：</td><td><input type="text" name="payment" id="payment" value="" /></td></tr></table>',
                okValue: '确定已支付',
                ok: function () {
                    var payment = $("#payment").val();
                    $.getJSON(url_pay_3,{payment:payment,money:total},function(json){
                        if(json.status == 'success') {
                            var d2 = dialog({
                               title: '修改支付状态',
                               content:"修改支付状态成功！"
                           });
                           d2.show();
                            get_btn();
                        } else {
							alert('操作失败');
                           // d.content('操作失败：'+json.msg);
                        }
                    });
                },
                cancelValue: '取消',
                cancel: function () {}
                
            });
            d.show();   
        }
        
        //订单发货
        function delivery_2() {
            var d = dialog({
                title: '订单发货',
                content:'<table cellpadding="10"><tr><td>配送公司：</td><td><input type="text" name="delivery_company" id="delivery_company" value="" /></td></tr><tr><td>配送公司代码：</td><td><input type="text" name="delivery_code" id="delivery_code" value="" /></td></tr><tr><td>配送单号：</td><td><input type="text" name="delivery_no" id="delivery_no" value="" /></td></tr></table>',
                okValue: '确定发货',
                ok: function () {
                    var delivery_company = $("#delivery_company").val();
					var delivery_code = $("#delivery_code").val();
                    var delivery_no = $("#delivery_no").val();
                    $.getJSON(url_delivery_2,{delivery_company:delivery_company,delivery_code:delivery_code,delivery_no:delivery_no},function(json){
                        if(json.status == 'success') {
                            var d2 = dialog({
                               title: '订单发货',
                               content:"订单发货成功！"
                           });
                           d2.show();
                            get_btn();
                        } else {
                            d.content('操作失败：'+json.msg);
                        }
                    });
                },
                cancelValue: '取消',
                cancel: function () {}
                
            });
            d.show();   
        }
        
        //确认到货
        function delivery_4() {
            var d = dialog({
                title: '系统提示'
            });
            d.content('<img src="'+root+'/Public/system/images/ajax_loading.gif" />正在操作中...，请稍等！');
            d.show();
            $.getJSON(url_delivery_4,function(json){
                if(json.status == 'success') {
                    d.content('操作成功');
                    get_btn();
                } else {
                    d.content('操作失败：'+json.msg);
                }
            });
        }
    </script>
    
</div>
